const path = require('path');

console.log(__dirname);
console.log(__filename);

// 绝对路径示例- D:\郑州职业技术学院\NodeJS 课程\课程包\第五章\PPT

// 1.解析路径 path.parse
console.log('path.parse: ', path.parse(__filename).ext);
console.log('path.parse: ', path.parse(__dirname));

// 2.获取路径名 path.basename
console.log('path.basename: ', path.basename(__filename));
console.log('path.basename: ', path.basename(__dirname));

// 3.路径名 path.dirname
console.log('path.dirname: ', path.dirname(__dirname));
console.log('==================================');

// 4.文件的后缀名 path.extname
console.log('path.extname:', path.extname(__filename));
console.log('path.extname:', path.extname(__dirname));

// 5.路径拼接 path.join
console.log('路径拼接', path.join(__dirname, 'a/b/c/d','525werqwersdfpath.js'));